<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <p v-for="item in list">
      {{item}}
    </p>
    <button @click="hSub">length-1</button>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.0-rc.1/vue.global.js"></script>
  <!-- <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.js"></script> -->
  <script>
    // vue2
    // const app = new Vue({
    //   el: '#app',
    //   data () {
    //     return {
    //       list: [1,2,3]
    //     }
    //   },
    //   methods: {
    //     hSub () {
    //       this.list.length--
    //     }
    //   }
    // })
  </script>
  <script>
  	// 这里是vue3的代码
    const { createApp } = Vue

    // 创建实例的方式变化了
    const app = createApp({
      data () {
        return {
          list: [1,2,3]
        }
      },
      methods: {
        hSub () {
          this.list.length--
        }
      }
    }).mount('#app')
  </script>
</body>
</html>